home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / pdriver5.arc / NI5210.ASM < prev    next >
Assembly Source File  |  1989-12-17  |  3KB  |  117 lines

  1. version    equ    2
  2.  
  3.     include    defs.asm
  4.  
  5. ;Ported from Tim Krauskopf's micnet.asm, an assembly language
  6. ;driver for the MICOM-Interlan NI5210, by Russell Nelson.  Any bugs
  7. ;are due to Russell Nelson.
  8. ;Updated to version 1.08 Feb. 17, 1989 by Russell Nelson.
  9. ;Updated to support 1500 byte MTU April 27, 1989 By Brad Clements.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. code    segment    byte public
  27.     assume    cs:code, ds:code
  28.  
  29. ;
  30. ;  Equates for controlling the MICOM board
  31. ;
  32. ;  I/O addresses, writing anything in AL trips these gates
  33. ;
  34. ;  First six addresses are the EPROM board Ether address (read)
  35. ;
  36. IORESET    EQU    0            ; reset the board
  37. IOCA    EQU    1            ; execute command which is in SCB
  38. IODIS    EQU    2            ; disable network connect
  39. IOENA    EQU    3            ; enable network
  40. IOINTON    EQU    4            ; enable interrupts
  41. IOINTOF    EQU    5            ; disable interrupts, '586 thinks it still ints
  42.  
  43. BUS_TYPE    equ    1
  44. BASE_OFFSET    equ    0
  45. GET_ADDR_INC    equ    1
  46.  
  47. ;
  48. ;  Data segment
  49. ;
  50.  
  51.     public    int_no
  52. int_no        db    2,0,0,0        ; interrupt number. 
  53. io_addr        dw    0360h,0        ; I/O address for card (jumpers)
  54. base_addr    dw      0d000h,0    ; base segment for board (jumper set)
  55.  
  56.     public    driver_class, driver_type, driver_name
  57. driver_class    db    1        ;from the packet spec
  58. driver_type    db    11        ;from the packet spec
  59. driver_name    db    "NI5210",0    ;name of the driver.
  60.  
  61. lbca:
  62. doca:
  63. ;we may be called from places in which ds is unknown.
  64.     assume    ds:nothing
  65.     loadport
  66.     setport    IOCA
  67.     out    dx,al            ; send it
  68.     ret
  69.     assume    ds:code
  70. ;yet, we really should assume ds==code for the rest of this stuff.
  71.  
  72. ;
  73. ; Here we include the code that is common between 82586 implementations.
  74. ; Everything above this is resident.
  75.     include    82586.asm
  76. ; Everything below this is discarded upon installation.
  77.  
  78.     public    usage_msg
  79. usage_msg    db    "usage: ni5210 <packet_int_no> <int_no> <io_addr> <base_addr>",CR,LF,'$'
  80.  
  81.     public    copyright_msg
  82. copyright_msg    db    "Packet driver for the MICOM-Interlan NI5210, version ",'0'+majver,".",'0'+version,".",'0'+i82586_version,CR,LF
  83.         db    "Portions Copyright 1988 The Board of Trustees of the University of Illinois",CR,LF,'$'
  84.  
  85. check_board:
  86.     mov    dx,io_addr    ; i/o address
  87.     add    dx,EADDR_LEN    ; look past the ethernet address.
  88.     in    al,dx
  89.     mov    bl,al        ; assemble pattern to check
  90.     inc    dx
  91.     in    al,dx
  92.     mov    bh,al
  93.     cmp    bx,05500h        ; pattern known to be there in ROM
  94.     jz    have_5210_io
  95.     pop    dx            ;drop our return address
  96.     mov    dx,offset no_5210_io_msg
  97.     jmp    error
  98. have_5210_io:
  99.  
  100.     mov    ax,base_addr
  101.     mov    cx,2000h        ;test only what we are going to use.
  102.     call    memory_test
  103.     jz    have_5210_mem
  104.     pop    dx            ;drop our return address
  105.     mov    dx,offset no_5210_mem_msg
  106.     jmp    error
  107. have_5210_mem:
  108.     ret
  109.  
  110.  
  111. no_5210_io_msg    db    "No 5210 found at that I/O address.",CR,LF,'$'
  112. no_5210_mem_msg    db    "No 5210 found at that memory address.",CR,LF,'$'
  113.  
  114. code    ends
  115.  
  116.     end
  117.